<template>
  <div>
    <el-tabs v-model="activeName"
             @tab-click="handleClick">
      <template v-for="(na) in navigation">
        <el-tab-pane :label="na.navigationTitle"
                     v-bind:key="String(na.navigationId)"
                     :name="String(na.navigationId)"></el-tab-pane>
      </template>
    </el-tabs>
  </div>
</template>
<script>
export default {
  data () {
    return {
      activeName: '',
      navigation: []
    }
  },
  methods: {
    handleClick (tab, event) {
      for (let tabs of this.$data.navigation) {
        if (this.StringUtils.verifyTheSame(tab.name, String(tabs.navigationId))) {
          this.$router.push({ name: tabs.navigationName })
        }
      }
    }
  },
  created () {
    let dataJson = this.NavigationsUtils.formatNavigations(this)
    this.$data.navigation = dataJson.navigationList
    this.$data.activeName = dataJson.activeId
    this.$router.push({ name: this.$data.navigation[0].navigationName })
  }
}
</script>

<style>
</style>
